// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*!
 * @file pointcloud2.cpp
 * This source file contains the definition of the described types in the IDL file.
 *
 * This file was generated by the tool gen.
 */

#ifdef _WIN32
// Remove linker warning LNK4221 on Visual Studio
namespace {
char dummy;
}  // namespace
#endif  // _WIN32

#include "pointcloud2.h"
#include <fastcdr/Cdr.h>

#include <fastcdr/exceptions/BadParamException.h>
using namespace eprosima::fastcdr::exception;

#include <utility>

PointCloud2::PointCloud2()
{
    // m_point_x com.eprosima.idl.parser.typecode.PrimitiveTypeCode@5702b3b1
    m_point_x = 0.0;
    // m_point_y com.eprosima.idl.parser.typecode.PrimitiveTypeCode@69ea3742
    m_point_y = 0.0;
    // m_point_z com.eprosima.idl.parser.typecode.PrimitiveTypeCode@4b952a2d
    m_point_z = 0.0;
    // m_command com.eprosima.idl.parser.typecode.StringTypeCode@3159c4b8
    m_command ="";
    // m_data com.eprosima.idl.parser.typecode.SequenceTypeCode@73846619


}

PointCloud2::~PointCloud2()
{





}

PointCloud2::PointCloud2(
        const PointCloud2& x)
{
    m_point_x = x.m_point_x;
    m_point_y = x.m_point_y;
    m_point_z = x.m_point_z;
    m_command = x.m_command;
    m_data = x.m_data;
}

PointCloud2::PointCloud2(
        PointCloud2&& x)
{
    m_point_x = x.m_point_x;
    m_point_y = x.m_point_y;
    m_point_z = x.m_point_z;
    m_command = std::move(x.m_command);
    m_data = std::move(x.m_data);
}

PointCloud2& PointCloud2::operator =(
        const PointCloud2& x)
{

    m_point_x = x.m_point_x;
    m_point_y = x.m_point_y;
    m_point_z = x.m_point_z;
    m_command = x.m_command;
    m_data = x.m_data;

    return *this;
}

PointCloud2& PointCloud2::operator =(
        PointCloud2&& x)
{

    m_point_x = x.m_point_x;
    m_point_y = x.m_point_y;
    m_point_z = x.m_point_z;
    m_command = std::move(x.m_command);
    m_data = std::move(x.m_data);

    return *this;
}

bool PointCloud2::operator ==(
        const PointCloud2& x) const
{

    return (m_point_x == x.m_point_x && m_point_y == x.m_point_y && m_point_z == x.m_point_z && m_command == x.m_command && m_data == x.m_data);
}

bool PointCloud2::operator !=(
        const PointCloud2& x) const
{
    return !(*this == x);
}

size_t PointCloud2::getMaxCdrSerializedSize(
        size_t current_alignment)
{
    size_t initial_alignment = current_alignment;


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1;

    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    current_alignment += (100 * 8) + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);




    return current_alignment - initial_alignment;
}

size_t PointCloud2::getCdrSerializedSize(
        const PointCloud2& data,
        size_t current_alignment)
{
    (void)data;
    size_t initial_alignment = current_alignment;


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.command().size() + 1;

    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    if (data.data().size() > 0)
    {
        current_alignment += (data.data().size() * 8) + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);
    }




    return current_alignment - initial_alignment;
}

void PointCloud2::serialize(
        eprosima::fastcdr::Cdr& scdr) const
{

    scdr << m_point_x;
    scdr << m_point_y;
    scdr << m_point_z;
    scdr << m_command;
    scdr << m_data;

}

void PointCloud2::deserialize(
        eprosima::fastcdr::Cdr& dcdr)
{

    dcdr >> m_point_x;
    dcdr >> m_point_y;
    dcdr >> m_point_z;
    dcdr >> m_command;
    dcdr >> m_data;
}

/*!
 * @brief This function sets a value in member point_x
 * @param _point_x New value for member point_x
 */
void PointCloud2::point_x(
        double _point_x)
{
    m_point_x = _point_x;
}

/*!
 * @brief This function returns the value of member point_x
 * @return Value of member point_x
 */
double PointCloud2::point_x() const
{
    return m_point_x;
}

/*!
 * @brief This function returns a reference to member point_x
 * @return Reference to member point_x
 */
double& PointCloud2::point_x()
{
    return m_point_x;
}

/*!
 * @brief This function sets a value in member point_y
 * @param _point_y New value for member point_y
 */
void PointCloud2::point_y(
        double _point_y)
{
    m_point_y = _point_y;
}

/*!
 * @brief This function returns the value of member point_y
 * @return Value of member point_y
 */
double PointCloud2::point_y() const
{
    return m_point_y;
}

/*!
 * @brief This function returns a reference to member point_y
 * @return Reference to member point_y
 */
double& PointCloud2::point_y()
{
    return m_point_y;
}

/*!
 * @brief This function sets a value in member point_z
 * @param _point_z New value for member point_z
 */
void PointCloud2::point_z(
        double _point_z)
{
    m_point_z = _point_z;
}

/*!
 * @brief This function returns the value of member point_z
 * @return Value of member point_z
 */
double PointCloud2::point_z() const
{
    return m_point_z;
}

/*!
 * @brief This function returns a reference to member point_z
 * @return Reference to member point_z
 */
double& PointCloud2::point_z()
{
    return m_point_z;
}

/*!
 * @brief This function copies the value in member command
 * @param _command New value to be copied in member command
 */
void PointCloud2::command(
        const std::string& _command)
{
    m_command = _command;
}

/*!
 * @brief This function moves the value in member command
 * @param _command New value to be moved in member command
 */
void PointCloud2::command(
        std::string&& _command)
{
    m_command = std::move(_command);
}

/*!
 * @brief This function returns a constant reference to member command
 * @return Constant reference to member command
 */
const std::string& PointCloud2::command() const
{
    return m_command;
}

/*!
 * @brief This function returns a reference to member command
 * @return Reference to member command
 */
std::string& PointCloud2::command()
{
    return m_command;
}
/*!
 * @brief This function copies the value in member data
 * @param _data New value to be copied in member data
 */
void PointCloud2::data(
        const std::vector<double>& _data)
{
    m_data = _data;
}

/*!
 * @brief This function moves the value in member data
 * @param _data New value to be moved in member data
 */
void PointCloud2::data(
        std::vector<double>&& _data)
{
    m_data = std::move(_data);
}

/*!
 * @brief This function returns a constant reference to member data
 * @return Constant reference to member data
 */
const std::vector<double>& PointCloud2::data() const
{
    return m_data;
}

/*!
 * @brief This function returns a reference to member data
 * @return Reference to member data
 */
std::vector<double>& PointCloud2::data()
{
    return m_data;
}

size_t PointCloud2::getKeyMaxCdrSerializedSize(
        size_t current_alignment)
{
    size_t current_align = current_alignment;








    return current_align;
}

bool PointCloud2::isKeyDefined()
{
    return false;
}

void PointCloud2::serializeKey(
        eprosima::fastcdr::Cdr& scdr) const
{
    (void) scdr;
         
}
